package cn.easybuy.service;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.easybuy.biz.Easybuy_Newsbiz;
import cn.easybuy.biz.Impl.Easybuy_NewsbizImpl;
import cn.easybuy.entity.Easybuy_News;

public class do_News extends HttpServlet {

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
	

		request.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");
		Easybuy_Newsbiz ea = new Easybuy_NewsbizImpl();
		String id1 = request.getParameter("nid");
		int id2=Integer.getInteger(id1);
		List<Easybuy_News> list = ea.findAllNewsByTid(id2);
		for (Easybuy_News easybuy_News : list) {
			int id = easybuy_News.getId();
			String title = easybuy_News.getTitle();
			String content = easybuy_News.getContent();
			String createTime = easybuy_News.getCreateTime();
			request.setAttribute("id", id);
			request.setAttribute("title", title);
			request.setAttribute("content", content);
			request.setAttribute("createTime", createTime);
			
		}
		if (list != null) {
			request.getRequestDispatcher("../Member2.jsp").forward(request,
					response);
		}
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
	}

}
